﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
using TN_CMS.Framework.Variable;

namespace TN_CMS.Domain.Entities
{
    public class SysRole
    {
        public SysRole()
        {
            this.SysAdmins = new HashSet<SysAdmin>();
            this.SysFeatures = new HashSet<SysFeature>();
        }

        [ScaffoldColumn(false)]
        public int Id { get; set; }

        [Required]
        [UIHint("TNText")]
        public string Name { get; set; }

        [Required]
        [UIHint("TNText")]
        public string Key { get; set; }

        [UIHint("TNLongText")]
        public string Description { get; set; }

        [UIHint("TNCheckBox")]
        [Display(Name = "Is System Role")]
        public bool IsSystemRole { get; set; }

        [UIHint("TNCheckBox")]
        [Display(Name = "Is Active")]
        public bool IsActive { get; set; }

        // extension

        [NotMapped]
        [ScaffoldColumn(false)]
        [Display(Name = "Total Features")]
        public int TotalFeatures { get; set; }

        public virtual ICollection<SysAdmin> SysAdmins { get; set; }

        public virtual ICollection<SysFeature> SysFeatures { get; set; }
    }
}
